package com.imau.mapper;

import com.imau.bean.Role;
import io.mybatis.mapper.Mapper;
import io.mybatis.mapper.base.EntityProvider;
import io.mybatis.provider.Caching;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

public interface RoleMapper extends Mapper<Role,String> {

    @Lang(Caching.class)
    @InsertProvider(
            type = EntityProvider.class,
            method = "insert"
    )
    @Options(
            useGeneratedKeys = false,//不使用数据库的自动主键生成
            keyProperty = "id"
    )
    <S extends Role> int insert(S entity);

    Role selectByRoleID(@Param("id") String id);
}
